
 

 

var Helloworld = cc.Layer.extend({
    isMouseDown:false,
    helloImg:null,
    helloLb:null,
    circle:null,
    sprite:null,

	
	//createButton:
	
	
    init:function () {
        var selfPointer = this;
        //////////////////////////////
        // 1. super init first
        this._super();

        var size = cc.Director.getInstance().getWinSize();

		
        // add "HelloWorld" splash screen"
        this.sprite = cc.Sprite.create("res/LightedBackground.png");
        this.sprite.setPosition(cc.p(size.width / 2, size.height / 2));
        this.sprite.setVisible(true);
        this.sprite.setAnchorPoint(cc.p(0.5, 0.5));
        this.addChild(this.sprite, 0);

		// avatar
		var avatar = cc.Sprite.create("res/avatar_body.png");
		avatar.setPosition(cc.p(size.width - 150, size.height / 2 - 150 ));
		avatar.setAnchorPoint(cc.p(0.5, 0));
		this.sprite.addChild(avatar, 0);
		
		// main text
		var helloLabel = cc.LabelTTF.create("Hello World", "Arial", 38);
        helloLabel.setPosition(cc.p(size.width / 2, size.height - 50));
        this.sprite.addChild(helloLabel, 5);
		
		
		this.setTouchEnabled(true);
		
		
		//Menu
		
		var items = new Array();
		var p = cc.p(0,100);
		
		items[0] = createButton("Presentation");
		items[0].setPosition( p );
		items[0].setCallback(this,
            function () {
				myApp.GoToScene( new presentationScene() );
            });
		
		p =  cc.p( p.x + 0, p.y -50 ); 
		items[1] = createButton("Projects");
		items[1].setPosition( p );
		items[1].setCallback(this,
            function () {
				myApp.GoToScene( new projectsScene() );
            });
			
		p =  cc.p( p.x + 0, p.y -50 ); 
		items[2] = createButton("water");
		items[2].setPosition( p );
		items[2].setCallback(this,
            function () {
				myApp.GoToScene( new waterScene() );
            });
			
			
		p =  cc.p( p.x + 0, p.y -50 ); 
		items[3] = createButton("piano");
		items[3].setPosition( p );
		items[3].setCallback(this,
            function () {
				myApp.GoToScene( new pianoScene() );
            });
			
			
		p =  cc.p( p.x + 0, p.y -50 ); 
		items[4] = createButton("meta");
		items[4].setPosition( p );
		items[4].setCallback(this,
            function () {
				myApp.GoToScene( new metaScene() );
            });
			
            
        p =  cc.p( p.x + 0, p.y -50 ); 
		items[5] = createButton("meta water");
		items[5].setPosition( p );
		items[5].setCallback(this,
            function () {
				myApp.GoToScene( new metaWaterScene() );
            });
            
		
		var myMenu = cc.MenuCustom.create(items);
		this.sprite.addChild(myMenu);
		
        return true;
    },
});


var HelloWorldScene = cc.Scene.extend({
    onEnter:function () {
        this._super();
        var layer = new Helloworld();
        layer.init();
        this.addChild(layer);
    }
});


